clear
set more off
cap log close
set logtype text


***** CHANGE TO OWN HOME DIRECTORY
global homedir "~/Dropbox/intgmob_AssortativeMating"

**** 
global maindir "$homedir/ReplicationPackage/Appendix_A"
global maintextdatdir "$homedir/ReplicationPackage/intermediatedata"
global rawdir "$maindir/raw_data"
global tempdir "$maindir/temp_data"
global datdir "$maindir/generated_data"
global outputdir "$maindir/output"

local max = 10
local iter_per_file = 5

use "$datdir/v2res1.dta", clear
forvalues i=2/`max' {
	append using "$datdir/v2res`i'.dta"
}

gen true_iteration = (file_num - 1)*`iter_per_file' + iteration

tab true_iteration

log using "$outputdir/tableA-10.txt", replace
table sigma2_ses_f sigma2_ses_m if sigma2_con_f==5 & sigma2_con_m==5, c(mean corr_pseudo)
log close

log using "$outputdir/tableA-11.txt", replace
table sigma2_ses_f sigma2_ses_m if sigma2_con_f==5 & sigma2_con_m==5, c(mean rsq_girl)
log close

log using "$outputdir/tableA-12.txt", replace
table sigma2_ses_f sigma2_ses_m if sigma2_con_f==5 & sigma2_con_m==5, c(mean rsq_boy)
log close
